package com.ydgk.jishuzhan.controller;

import com.ydgk.jishuzhan.beans.AjaxResult;
import com.ydgk.jishuzhan.beans.UserInfo;
import com.ydgk.jishuzhan.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@RequestMapping("/userInfo")
@Controller
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @ResponseBody
    @RequestMapping("/doEdit")
    public AjaxResult doEdit(UserInfo userInfo){
        AjaxResult ajaxResult = new AjaxResult();
        try {
            userInfoService.updateUserInfo(userInfo);
            ajaxResult.setSuccess(true);
        }catch ( Exception e ) {
            ajaxResult.setSuccess(false);
            e.printStackTrace();
        }
        return ajaxResult;
    }

}
